﻿@using ShowPin.MvcPaging
@model IPagedList<ShowPin.MvcPaging.Demo.Models.Product>
@{
    ViewBag.Title = "带搜索参数的例子（一）";
}
<h2>根据分类浏览产品——根据产品分类搜索分页</h2>
@using (Html.BeginForm("PagingByCategory", "Paging", FormMethod.Get))
{
	<p>
		选择产品分类：
		@Html.DropDownList("categoryName")
		<input type="submit" value="提交" />
	</p>
}
@if (Model.TotalItemCount > 0)
{
    <table class="table">
        <thead>
            <tr>
                <th>产品名称</th>
                <th>分类名称</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var product in Model.Source)
            {
                <tr>
                    <td>@product.Name</td>
                    <td>@product.Category</td>
                </tr>
            }
        </tbody>
    </table>
@Html.Pager(Model.PageSize, Model.CurrentPage, Model.TotalItemCount).Options(o => o.HtmlAttributes(new { @class = "pagination pagination-large" }).RouteValues(new { categoryname = ViewBag.CategoryDisplayName }))
}
